<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			div{
				line-height: 500px;
				background: pink;
				text-align: center;
				font-size: 100px;
			}
		</style>
	</head>
	<body>
		<div>1</div>
		
		<script type="text/javascript">
			var d1=document.getElementsByTagName("div")[0];
			d1.onmousemove=function(){
				rs();//就会不断的触发 
			}
			
			function move1(){
				var timer;//保存定时器的地方
				return function(){
					//判断有没有定时器，有的话就清空
					if(timer){clearTimeout(timer)}
					//在开启一个定时器
					timer=setTimeout(function(){
						d1.innerHTML=parseInt(d1.innerHTML)+1;
					},1000)
			}
			
			var rs=move1();
			
		</script>
	</body>
</html>
